home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 13418 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: erich.triumf.ca!bennett
  2. From: bennett@erich.triumf.ca (P.Bennett)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Help:what is wrong this code?
  5. Date: 5 Apr 1996 22:11 PST
  6. Organization: TRIUMF: Tri-University Meson Facility
  7. Distribution: world
  8. Message-ID: <5APR199622112909@erich.triumf.ca>
  9. References: <4k3p3q$n76@brahms.udel.edu>
  10. NNTP-Posting-Host: ftp.triumf.ca
  11. News-Software: VAX/VMS VNEWS 1.50    
  12.  
  13. In article <4k3p3q$n76@brahms.udel.edu>, yuehong@brahms.udel.edu (Yue-hong Zheng) writes...
  14. >Why it give me 0.0000?
  15. >#include <stdio.h>
  16. >main () {
  17. >double a=9.008;
  18. >printf("%f\n",sqrt(a));
  19. >return 0;
  20. >}
  21.  
  22. Since sqrt() doesn't return an int, you have to make sure a prototype is in
  23. scope, by adding #include <math.h>.
  24.  
  25.  
  26.  
  27. Peter Bennett VE7CEI                | Vessels shall be deemed to be in sight
  28. Internet: bennett@triumf.ca         | of one another only when one can be
  29. Packet: ve7cei@ve7kit.#vanc.bc.ca   | observed visually from the other
  30. TRIUMF, Vancouver, B.C., Canada     |                          ColRegs 3(k)
  31. GPS and NMEA info and programs: ftp://sundae.triumf.ca/pub/peter/index.html
  32. or: ftp://ftp-i2.informatik.rwth-aachen.de/pub/arnd/GPS/peter/index.html
  33.  
  34.